<script lang="ts" setup>
import { reactive } from 'vue'
import type { UploadFile } from 'element-plus'
import { ref } from 'vue'
// do not use same name with ref
const form = reactive({
    revenew:'',
    APK_version: '',
    APK_download: 'https://www.pgyer.com/gU89',
    APK_revenew: '系统升级，新增功能，点击确认马上更新!',
    IPA_version: '',
    IPA_up_version: '3',
    IPA_download: 'https://www.copy.im/a/iKupc5',
    IPA_revenew: '有新版本，请更新，后台可设置是否强制更新',
    erweima_download: '',
})
const dialogImageUrl = ref('')
const dialogVisible = ref(false)
const disabled = ref(false)
const handleRemove = (file: UploadFile) => {
    console.log(file)
}

const handlePictureCardPreview = (file: UploadFile) => {
    dialogImageUrl.value = file.url!
    dialogVisible.value = true
}

const handleDownload = (file: UploadFile) => {
    console.log(file)
}

const onSubmit = () => {
    console.log('submit!')
}

</script>
<template>
    <el-form :model="form" label-width="auto" style="max-width: 700px">
        <el-form-item label="强制更新：">
            <el-select v-model="form.revenew" placeholder="关闭">
                <el-option label="开启" value="1"/>
                <el-option label="关闭" value="2"/>
            </el-select>
        </el-form-item>
        <el-form-item label="APK版本号：" size="2px">
            <el-input v-model="form.APK_version" disabled placeholder="5.2.1"  />
            <h3>安卓app最新版本号，请勿修改</h3>
        </el-form-item>
        <el-form-item label="APK下载链接：" size="2px">
            <el-input v-model="form.APK_download"  placeholder=""/>
            <h3>安卓最新版APK下载链接</h3>
        </el-form-item>
        <el-form-item label="APK更新说明：" size="2px">
            <el-input v-model="form.APK_revenew"  placeholder=""/>
            <h3>APK更新说明(200字以内)</h3>
        </el-form-item>
        <el-form-item label="IPA版本号：" size="2px">
            <el-input v-model="form.IPA_version" disabled placeholder="3"/>
            <h3>IOS最新版本号，请勿随意修改</h3>
        </el-form-item>
        <el-form-item label="IPA上架版本号：" size="2px" >
            <el-input v-model="form.IPA_up_version"  placeholder=""/>
            <h3>IOS上架审核中版本的版本号(用于上架期间隐藏上版本部分功能。不要和IPA版本号相同)</h3>
        </el-form-item>
        <el-form-item label="IPA下载链接：" size="2px" >
            <el-input v-model="form.IPA_download"  placeholder=""/>
            <h3>IOS最新版IPA下载链接</h3>
        </el-form-item>
        <el-form-item label="IPA更新说明：" size="2px" >
            <el-input v-model="form.IPA_revenew"  placeholder=""/>
            <h3>IPA更新说明(200字以内)</h3>
        </el-form-item>
        <el-form-item label="二维码下载链接" size="">
            <el-upload action="#" list-type="picture-card" :auto-upload="false">
                <el-icon>
                    <Plus />
                </el-icon>
                <template #file="{ file }">
                    <div>
                        <img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
                        <span class="el-upload-list__item-actions">
                            <span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
                                <el-icon><zoom-in /></el-icon>
                            </span>
                            <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleDownload(file)">
                                <el-icon>
                                    <Download />
                                </el-icon>
                            </span>
                            <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
                                <el-icon>
                                    <Delete />
                                </el-icon>
                            </span>
                        </span>
                    </div>
                </template>
            </el-upload>
            <el-dialog v-model="dialogVisible">
                <img w-full :src="dialogImageUrl" alt="Preview Image" />
            </el-dialog>
            <h3>PC下载页面用二维码生成链接：</h3>
            <h3>https://live.sshdjm.com//Portal/index/scanqr</h3>
        </el-form-item>
        <el-button type="info" plain>保存</el-button>


    </el-form>
</template>
<style scoped>
.el-form-item h3{
    color:#999;
    font-size: 14px;
}
.el-button{
    margin-left: 120px;
    color:#123;
}
</style>